Maps for UWP Tutorials / Marking a Route with a C1VectorPolyline / Step 1 of 3: Creating the Application
Step 1 of 3: Creating the Application

In this step, you'll create your application and add markup.

In this step, you will create a new Universal Windows application and set up your XAML view.

  1. Select File | New | Project to open the New Project dialog box.
  1. Select Templates | Visual C# | Windows | Universal. From the templates list, select Blank App (Universal Windows).
  2. Enter a name for your application and click OK. A new, blank application will open.
  1. In the Solution Explorer, right-click the References file and select Add Reference from the list. Browse to locate the following assembly references:
  • C1.UWP.dll
  • C1.UWP.DX.dll
  • C1.UWP.Maps.dll
  • C1.UWP.Zip.dll
  1. Double-click the MainPage.xaml file to open it.
  2. Locate the C1Maps control in the Visual Studio Toolbox and double click to add it to your application.
  3. Edit the <Maps: C1Maps/> tag to resemble the following:
XAML
Copy Code
<Maps:C1Maps Name="maps" Foreground="White" ></Maps:C1Maps>
  1. Next, you'll set the minimum and maximum latitude and longitude values to set the map boundaries. Edit the markup to resemble the following.
XAML
Copy Code
<Maps:C1Maps Name="maps" Foreground="White" MaxLat="70" MinLat="35" MaxLong="146" MinLong="25"></Maps:C1Maps>
  1. Now, edit the <Maps:C1Maps> tag to set a center. For this project, you'll set the Center property to the latitude and longitude values for Novosibirsk:
XAML
Copy Code
<Maps:C1Maps Name="maps" Foreground="White" MaxLat="70" MinLat="35" MaxLong="146" MinLong="25" Center="82.9333, 55.0167"></Maps:C1Maps>
  1. Then set the MinZoomValue:
XAML
Copy Code
<Maps:C1Maps Name="maps" Foreground="White" MaxLat="70" MinLat="35" MaxLong="146" MinLong="25" Center="82.9333, 55.0167" MinZoom="3"> </Maps:C1Maps>
  1. Place your cursor between the <Maps:C1Maps> </Maps:C1Maps> tags. Add the following Maps Resources and C1VectorLayer:
XAML
Copy Code
<Maps:C1Maps.Resources>
     <!--Item template -->
     <DataTemplate x:Key="templPts">
         <Maps:C1VectorPlacemark GeoPoint="{Binding Path=LongLat}" Fill="LightGreen" Stroke="DarkGreen" Label="{Binding Path=Name}" LabelPosition="Right" FontSize="14">
             <Maps:C1VectorPlacemark.Geometry>
                 <EllipseGeometry RadiusX="2" RadiusY="2" />
             </Maps:C1VectorPlacemark.Geometry>
         </Maps:C1VectorPlacemark>
     </DataTemplate>
 </Maps:C1Maps.Resources>
 <Maps:C1VectorLayer ItemsSource="{Binding}" ItemTemplate="{StaticResource templPts}"/>

In this step, you created an application, added the appropriate references, and added XAML markup to create a C1Maps control, map resources, and a C1VectorLayer.